package com.qujia.station.utils;


import java.util.Calendar;
import java.util.Random;

/**
 * 生成随机码
 * */
public class CodeUtil {

    public static String createCode(){
        // 生成订单号
        Random random = new Random();
        String result = "";
        for (int i = 0; i < 6; i++) {
            result += random.nextInt(10);
        }
        return System.currentTimeMillis() + result;
    }

    /**
     * 生成
     * */
    public static String stationCode(){
        Calendar cal = Calendar.getInstance();
        int m = 0;
        Random random=new Random();
        String result1 = "";
        for (int i = 0; i < 4; i++) {
            result1 += random.nextInt(10);
        }
        int year = cal .get(Calendar.YEAR);
        int month = cal .get(Calendar.MONTH) + 1;
        int yearcount=year-2000;
        return "S"+yearcount+month+"0001"+result1;
    }
}
